package clases;

import main.Errores;
import main.Global;

/**
  *  4g3nt
  *  Copyright (C) 2008  Carlos Molinero y César Andrés
  *
  *  This program is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation, either version 3 of the License, or
  *  (at your option) any later version.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
  *
  *    You should have received a copy of the GNU General Public License
  *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  */
public class ParesAC {
    String _agente;
    String _celula;
    public ParesAC(String agente, String celula)
    {
        _agente= agente;
        _celula= celula;
    }
    public ParesAC() {
		// TODO Apéndice de constructor generado automáticamente
	}
    public ParesAC(ParesAC paresac)
    {
    	_agente = paresac._agente;
    	_celula=paresac._celula;
    }
	public void print()
    {
		 Global.escribir("<li><span class=\"file\">Celula="+_celula+"</span></li>");
		 Global.escribir("<li><span class=\"file\">Agente="+_agente+"</span></li>");
		 if (Global.getCelula(_celula)==null) {
			 	Errores.insertar("No se ha definido la celula "+_celula);
			 	Errores.insertar("No se ha definido el agente "+_agente+" en la celula "+_celula);
		 }
		 else
		 {
			 Celula var_celula = Global.getCelula(_celula);
			 if (var_celula.getAgente(_agente)==null) Errores.insertar("<li><span class=\"file\">No se ha definido el agente "+_agente+" en la celula "+_celula+"</span></li>");
		 }
    	
    }
	public void setCelula(String celula) {
		_celula = celula;
		
	}
	public void setAgente(String agente)
	{
		_agente = agente;
	}
	public String getCelula()
	{	
			return _celula;
	}
	public String getAgente()
	{
		return _agente;
	}
        
	
    @Override
        public String toString()
	{
		return "["+_celula+","+_agente+"]";
	}
}